import { checkToken } from '../api/user'
import { getToken, getUserInfo } from './storage'
import config from '../config/index'

export const checkLogin = async () => {
	if (!getToken()) return
	let user = JSON.parse(getUserInfo()) as User
	const res = await checkToken(user.id)
	if (res.statusCode === config.SUCCESS_CODE) {
		return res.data
	}
}